import java.util.*;
public class Example1
{
	public static void main(String args[])
	{
		for(int i=0;i<10;i++)
		new Thread (new XYZ(i)).start();
	}
}
class XYZ implements Runnable
    {
		static Random n = new Random();
		int threadID;
		public XYZ(int id)
		{
			threadID=id;
		}
		public void run()
		{
			while(true)
			{
				for(int i=0;i<threadID;i++)
					System.out.printf("             ");
				System.out.println("I am thread "+threadID+"\n");
				try 
				{
					Thread.sleep(n.nextInt(4000-1000+1)+1000);
				}
				catch(InterruptedException e)
				{
				}
			}
		}
	}